#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys

def showC(c, p=''):
    n = float(255)
    print  '[%.3f, %.3f, %.3f, 1.]  %s'%(c.red()/n,  c.green()/n, c.blue()/n,p)

#chaque programme doit disposer d'une instance de QApplication grant l'ensemble des widgets
app=QApplication([])
#un nouveau bouton
#button=QPushButton("Hello World !", None)
button=QColorDialog()
#qu'on affiche
button.show()
#fin de l'application lorsque
app.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()"))
#fin de l'application lorsque l'utilisateur clique sur le bouton
#app.connect(button, SIGNAL("clicked()"),app,SLOT("quit()"))
#boucle principale de traitement des évènements
app.connect(button, SIGNAL("currentColorChanged(QColor)"),showC)


clist=[
"880906", "661F1D", "580402", "C43B37", "C45F5D",0,
## Secondary Color A:                          
"884206", "663F1D", "582A02", "C47837", "C48C5D",0,
## Secondary Color B:                          
"6E053E", "521738", "470228", "B7347B", "B7578B",0,
## Complementary Color:                        
"056B0B", "17501A", "024606", "33B53C", "56B55C",0,
]
for c in clist:
    if c==0:
        print "# -----"
        continue
    co = QColor("#"+c)
    showC(co, "#   #"+c)

app.exec_()


